package com.example.batterynotification;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class PowerConnectionReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction() == Intent.ACTION_POWER_CONNECTED) 
		{
			Toast.makeText(context, "PLUGGED", Toast.LENGTH_SHORT).show();
			batteryLevelReceiver.setCounter(0);
			batteryLevelReceiver.setTotalTime(0);
		} 
		else if (intent.getAction() == Intent.ACTION_POWER_DISCONNECTED)
		{
			Toast.makeText(context, "UNPLUGGED", Toast.LENGTH_SHORT).show();
			batteryLevelReceiver.setCounter(0);
			batteryLevelReceiver.setTotalTime(0);
		}
	}
	

}
